package metu.tespit.session.semester;

import java.util.Arrays;
import java.util.Date;

import metu.tespit.entity.semester.Semester;

import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;

/**
 
 * @created May 20, 2012
 */
@Name("semesterList")
public class SemesterList extends EntityQuery<Semester>{

	/**
	 * 
	 */
	private static final long serialVersionUID = -1087320908001920651L;
	private static final String[] RESTRICTIONS = {
		"semester.startDate <= #{semesterList.currentDate}",
		"semester.endDate >= #{semesterList.currentDate}",
		};
	
	
	public SemesterList()
	{
		setEjbql("select semester from Semester semester");
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
	}
	
	private Date currentDate;


	public Date getCurrentDate() {
		return currentDate;
	}

	public void setCurrentDate(Date currentDate) {
		this.currentDate = currentDate;
	}
	
//
//	@Scope(ScopeType.EVENT)
//	@Name("semesterRestricitons")
//	public class SemesterRestrictions {
//		
//		private Date currentDate;
//
//		/**
//		 * @param currentDate the currentDate to set
//		 */
//		public void setCurrentDate(Date currentDate) {
//			this.currentDate = currentDate;
//		}
//
//		/**
//		 * @return the currentDate
//		 */
//		public Date getCurrentDate() {
//			return currentDate;
//		}
//       
//    }
}
